#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time      :2022/6/2 17:00
# @Author    :cjw

# 黑名单列表
black_list = []


def black_wrapper(fun):
	"""异常弹框处理"""

	def run(*args, **kwargs):
		base_page = args[0]
		try:
			return fun(*args, **kwargs)
		except Exception as e:
			for black in black_list:
				elements = base_page.driver.find_elements(*black)
				if len(elements) > 0:
					elements[0].click()
					return fun(*args, **kwargs)
			raise e

	return run
